 import request from "@/utlis/request";
export const login = (data)=> {
    return request({
        method:'POST',
        url:'login',
        data
    })
}
export  const menus=() => {
    return request({
        method:'get',
        url:'menus'
    })
}
export  const meuns2=({pagenum,pagesize,query})=> {
    return request({
        method:'GET',
        url:'users',
        params: {
            pagenum,
            pagesize,
            query
        }
    })
}
//获取列表数据
export const users = (data)=> {
    return request({
        method:'post',
        url:'/users',
        data
    })
}
//修改状态
export const falses =(id,state)=> {
    return request({
        method:'put',
        url:`users/${id}/state/${state}`
    })
 }
 export  const addmenu=()=> {
return request({
    method:'post',
    url:'users'
})
 }
 export  const idchange=(id)=> {
    return request({
        method:'GET',
        url:`/users/${id}`,

    })
 }
 //修改用户数据
 export const changeList=(id, data)=>{
   return  request({
        method:'put',
       url:`users/${id}`,
       data,
    })
 }
 //删除用户
 export const del=(id)=> {
    return request({
        method:'delete',
        url:`users/${id}`
    })
 }
 //获取rights列表的数据
 export const getRightListAPI=()=> {
    return request({
        method:'get',
        url:'rights/list'
    })
 }
 //获取角色列表数据
 export const getRolesList=()=> {
    return request({
        method:'get',
        url:'roles'
    })
 }
 //删除权限
 export const delroles=(id,id1)=> {
    return request({
        method:'delete',
        url:`roles/${id}/rights/${id1}`
    })
 }
 //获取分配权限的所有数据
 export const getquanxianlist=()=> {
    return request({
        method:'get',
        url:'rights/tree'
    })
 }
 //获取分配权限的添加后的数据
 export const getkeyadd=(id,data)=> {
    return request({
        method:'post',
        url:`roles/${id}/rights`,
        data,
    })
 }
 //拿到新增用户后的列表
 export const getcartlist=(data)=> {
    return request({
        method:'post',
        url:'roles',
        data
    })
 }
 //通过id拿到需要修改的那条数据的id
 export const getchangeList=(id)=> {
    return request({
        method:'get',
        url:`roles/${id}`
    })
 }
 //修改编辑用户信息
 export const changeyonghuList=(id,data)=> {
    return request({
        method:'put',
        url:`roles/${id}`,
        data
    })
 }
 //删除用户信息
 export const delteyonghu=(id)=> {
    return request({
        method:'delete',
        url:`role/${id}`
    })
 }
 //分配角色
 export const getjueseList=()=> {
    return request({
        method:'get',
        url:'roles'
    })
 }
 export const getjuesefenpei=(id,data)=> {
    return request({
        method:'put',
        url:`users/${id}/role`,
        data
    })
 }
 //////goods页面
 //获取页面所有列表数据
 export const getgoodList=({pagenum,pagesize,query})=> {
    return request({
        method:'get',
        url:'goods',
        params: {
            pagenum,
            pagesize,
            query
        }
    })
 }
 //获取点击编辑指定id的数据
 export const getgoodsListId=(id)=> {
    return request({
        method:'get',
        url:`goods/${id}`
    })
 }
 //删除指定id的数据
 export const deletegoodsList=(id)=> {
    return request({
        method:'delete',
        url:`goods/${id}`
    })
 }
 //categories页面接口
 //获取所有列表数据
 export const getcategoriesList=(data)=> {
    return request({
        method:'get',
        url:'categories',
        params:data,
    })
 }
 export const getCategories=()=> {
    return request({
        method:'get',
        url:'/categories',
        params:{
            type:2
        }
    })
 }
 export const addjiekou=(data)=> {
    return request({
        method:'post',
        url:'/categories',
        data
    })
 }
 //order页面
 export const getorderlist = (data) => {
     return request({
         url: "orders",
         method: "get",
         params: data,
     });
 };
 export const getorderlistapi = (id) => {
     return request({
         url: `orders/${id}`,
         method: "get",
     });
 };
 export const getorder = (id, data) => {
     return request({
         url: `orders/${id}`,
         method: "put",
         data,
     });
 };
 //params页面接口
 //获取所有数据
 export const getparamsApi=()=> {
     return request({
         method:'get',
         url:'categories'
     })
 }
export const getmany=(id,params)=> {
     return request({
         method:'get',
         url:`categories/${id}/attributes`,
         params,
     })
}
export const postaddForm=(id,data)=> {
return request({
    method:'post',
    url:`categories/${id}/attributes`,
    data
})
 }
 export const changebianji=(id,id1,params)=> {
     return request({
         method:'get',
         url:`categories/${id}/attributes/${id1}`,
         params
     })
 }
 export const putchangebianji=(id,id2,data)=> {
     return request({
         method:'put',
         url:`categories/${id}/attributes/${id2}`,
         data
     })
 }
 export  const delcategories=(id,id1)=> {
     return request({
method:'delete',
         url:`categories/${id}/attributes/${id1}`
     })
 }